// pages/index2/index2.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    one: 10,
    current: 1,
    showModalStatus: false,
    animationData: '',
    hiddenName: true,
    flag: false,
    data:
        {
          type: "选择题",
          stem: "1+1=？",
          caption: "1. 5\n2. 6\n3. -1\n",
          answer: "67",
          flag: false
        },
    data2: [
      {num: 1},



    ]
  },


  choseBtnColor: function (e) {
    var id = e.currentTarget.dataset.id;  //获取自定义的ID值
    console.log(e.currentTarget.dataset.id)
    this.setData({
      one: id
    })
    this.setData({
      showModalStatus: false,
    })
  },

  showModal: function () {
    // 显示遮罩层
    var animation = wx.createAnimation({
      duration: 200,
      timingFunction: "ease-in-out",
      delay: 0
    })
    this.animation = animation
    animation.translateY(500).step()
    this.setData({
      animationData: animation.export(),
      showModalStatus: true
    })
    setTimeout(function () {
      animation.translateY(0).step()
      this.setData({
        animationData: animation.export()
      })
    }.bind(this), 200)
  },
  passr: function () {
    this.setData({
      flag: true
    })
  },
  hideModal: function () {
    this.setData({
      showModalStatus: false,
    })

  },

  click: function (e) {
    this.setData({
      hiddenName: !this.data.hiddenName
    })
  },

  handleChange({detail}) {
    const type = detail.type;
    if (type === 'next') {
      this.setData({
        current: this.data.current + 1
      });
    } else if (type === 'prev') {
      this.setData({
        current: this.data.current - 1
      });
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})
